package com.mall.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.entity.Users;
import com.mall.mapper.UsersMapper;
import com.mall.ultis.ParamCheck;
import com.mall.ultis.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping
public class Index {

    @Resource
    UsersMapper usersMapper;

    @GetMapping
    public Result index(@ParamCheck String users) {
        IPage< Users > data = usersMapper.selectPage( new Page<Users>(0, 10  ), null );

        Users user = usersMapper.selectOne( new QueryWrapper<Users>( ).eq( "id", 1 ) );

        return Result.success( data );
    }

}
